import { defineConfig, presetAttributify, presetUno } from "unocss";
import { presetRemRpx } from "@unocss-applet/preset-rem-rpx";

export function createConfig({ strict = true, dev = true } = {}) {
  return defineConfig({
    envMode: dev ? "dev" : "build",
    presets: [
      presetAttributify({ strict }),
      presetUno(),
      presetRemRpx({ baseFontSize: 16, screenWidth: 750, mode: "rpx2rem" }),
    ],
    shortcuts: [
      {
        "col-center": "flex flex-col items-center",
        "start-center": "flex items-center",
        "space-between-center": "flex flex-justify-between items-center",
        // "space-between": "flex flex-justify-between",
        "align-center": "flex flex-items-center",
        center: "flex flex-col items-center",
      },
      ["bg-primary", "bg-[#dbb663]"],
      ["text-primary", "text-[#dbb663]"],
      ["border-primary", "border-color-[#F6A623]"],
      ["body-content", "w-full bg-gray-1"],
    ],
    content: {
      pipeline: {
        include: [
          // the default
          /\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/,
          // 这里只写我需要的，参考：https://unocss.dev/guide/extracting#extracting-from-build-tools-pipeline
        ],
        // exclude files
        // exclude: []
      },
    },
  });
}

export default createConfig();
